﻿@model HdipCricketClub.ViewModels.CompletedScoreCardViewModel

@{
    ViewBag.Title = "Scorecard";
}

<h2>@ViewBag.Title</h2>

<p>
@Html.DisplayFor(ModelItem => Model.CurrentFixture.Team.name)
vs @Html.DisplayFor(ModelItem => Model.CurrentFixture.Opponent.club_name) @Html.DisplayFor(ModelItem => Model.CurrentFixture.Opponent.team_name)
on @Html.DisplayFor(ModelItem => Model.CurrentFixture.date)
</p>

<p>Innings of</p>
<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            How Out:
        </th>
        <th>
            Fielder:
        </th>
        <th>
            Bowler:
        </th>
        <th>
            Runs:
        </th>
    </tr>
@foreach (var item in Model.ClubBatsmen)
{
<tr>    
    <td>
        @Html.DisplayFor(ModelItem => item.batsman_number)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.Member.first_name) @Html.DisplayFor(modelItem => item.Member.last_name)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.DismissalType.type)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.fielder_name)
    </td>   
    <td>
        @Html.DisplayFor(ModelItem => item.bowler_name)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.batting_runs)
    </td>
</tr>
}
</table>
Sub Total: @ViewBag.SubTotalClubBatsmen<br />
Extras:<br />
@Html.LabelFor(model => Model.ClubOtherDetails.byes)     @Html.DisplayFor(model => Model.ClubOtherDetails.byes) @Html.ValidationMessageFor(model => Model.ClubOtherDetails.byes)
<br />
@Html.LabelFor(model => Model.ClubOtherDetails.leg_byes) @Html.DisplayFor(model => Model.ClubOtherDetails.leg_byes) @Html.ValidationMessageFor(model => Model.ClubOtherDetails.leg_byes)
<br />
@Html.LabelFor(model => Model.ClubOtherDetails.wides)    @Html.DisplayFor(model => Model.ClubOtherDetails.wides) @Html.ValidationMessageFor(model => Model.ClubOtherDetails.wides)
<br />
@Html.LabelFor(model => Model.ClubOtherDetails.no_balls) @Html.DisplayFor(model => Model.ClubOtherDetails.no_balls) @Html.ValidationMessageFor(model => Model.ClubOtherDetails.no_balls)
<br />
Total Extras: @ViewBag.TotalClubExtras
<br />
Total: @ViewBag.TotalClubRuns   
<br /><br />  
<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            Overs:
        </th>
        <th>
            Maidens:
        </th>
        <th>
            Wickets:
        </th>
        <th>
            Runs:
        </th>
     </tr>
@foreach (var item in Model.OpponentBowlers)
{
<tr>    
    <td>
        @Html.DisplayFor(ModelItem => item.op_bowler_number)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.op_player_name)
    </td>
    
    <td>
        @Html.DisplayFor(ModelItem => item.op_overs)
    </td>   
    <td>
        @Html.DisplayFor(ModelItem => item.op_maidens)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.op_wickets)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.op_bowling_runs)
    </td>
</tr>
}
</table>
 
<p>Innings of</p>
<table>
    <tr>
        <th></th>
        <th>
            Name:
        </th>
        <th>
            How Out:
        </th>
        <th>
            Fielder:
        </th>
        <th>
            Bowler:
        </th>
        <th>
            Runs:
        </th>
    </tr>

@foreach (var item in Model.OpponentBatsmen)
{
<tr>    
    <td>
        @Html.DisplayFor(ModelItem => item.op_batsman_number)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.op_player_name)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.DismissalType.type)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.op_how_out)
    </td>   
    <td>
        @Html.DisplayFor(ModelItem => item.op_bowler_name)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.op_batting_runs)
    </td>
</tr>
}
</table>
    Sub Total: @ViewBag.SubTotalOpponentBatsmensRuns
    <br />
    @Html.LabelFor(model => Model.OpponentOtherDetail.byes) @Html.DisplayFor(model => Model.OpponentOtherDetail.byes) @Html.ValidationMessageFor(model => Model.OpponentOtherDetail.byes)
    <br />
    @Html.LabelFor(model => Model.OpponentOtherDetail.leg_byes) @Html.DisplayFor(model => Model.OpponentOtherDetail.leg_byes) @Html.ValidationMessageFor(model => Model.OpponentOtherDetail.leg_byes)
    <br />
    @Html.LabelFor(model => Model.OpponentOtherDetail.wides)    @Html.DisplayFor(model => Model.OpponentOtherDetail.wides) @Html.ValidationMessageFor(model => Model.OpponentOtherDetail.wides)
    <br />
    @Html.LabelFor(model => Model.OpponentOtherDetail.no_balls) @Html.DisplayFor(model => Model.OpponentOtherDetail.no_balls) @Html.ValidationMessageFor(model => Model.OpponentOtherDetail.no_balls)
    <br />
    Total Extras: @ViewBag.TotalOpponentExtras
    <br />
    Total: @ViewBag.TotalOpponentRuns
    <br /><br />
<table>
    <tr>
        <th>
        </th>
        <th>
            Name:
        </th>
        
        <th>
            Overs:
        </th>
        <th>
            Maidens:
        </th>
        <th>
            Wickets:
        </th>
        <th>
            Runs:
        </th>
     </tr>
@foreach (var item in Model.ClubBowlers)
{
<tr>    
   <td>
        @Html.DisplayFor(ModelItem => item.bowler_number)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.Member.first_name) @Html.DisplayFor(ModelItem => item.Member.last_name)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.overs)
    </td>   
    <td>
        @Html.DisplayFor(ModelItem => item.maidens)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.wickets)
    </td>
    <td>
        @Html.DisplayFor(ModelItem => item.bowling_runs)
    </td>
</tr>
}
</table>

<p>
    @Html.ActionLink("Back to list", "ViewScoreCards", "Results")
</p>